package com.lecyon.farm.vo.query;

import com.google.common.collect.Lists;
import com.lecyon.farm.util.StringHelper;
import com.lecyon.farm.util.ValidateUtils;
import com.lecyon.farm.vo.base.BaseQueryVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author YaoZheng
 * @since 2020-04-02
 */
@Data
@ApiModel("查询农机作业历史Vo")
public class QueryFmWorkVo extends BaseQueryVo {

    @ApiModelProperty(name = "id", value = "编号")
    private String id;

    @ApiModelProperty(name = "carId", value = "农机号")
    private String carId;

    @ApiModelProperty(name = "carIdList", value = "农机号集合")
    private List<String> carIdList = Lists.newArrayList();

    @ApiModelProperty(name = "carOwner", value = "车主")
    private String carOwner;

    @ApiModelProperty(name = "carOwnerPhone", value = "电话")
    private String carOwnerPhone;

    @ApiModelProperty(name = "province", value = "省份代码")
    private String province;

    @ApiModelProperty(name = "city", value = "城市代码")
    private String city;

    @ApiModelProperty(name = "county", value = "区县代码")
    private String county;

    @ApiModelProperty(name = "towns", value = "乡镇代码")
    private String towns;

    @ApiModelProperty(name = "id", value = "耕种类型")
    private String type;

    @ApiModelProperty(name = "beginDate", value = "开始日期")
    private LocalDate beginDate;

    @ApiModelProperty(name = "endDate", value = "结束日期")
    private LocalDate endDate;

    @ApiModelProperty(name = "queryBeginTime", value = "查询开始时间")
    private LocalDateTime queryBeginTime;

    @ApiModelProperty(name = "queryEndTime", value = "查询结束时间")
    private LocalDateTime queryEndTime;

    private String cooperationId;

    private String userId;

    private boolean quickSearch = true;

    public boolean isQuickSearch() {
        quickSearch = true;
        if (ValidateUtils.isNotNullOrEmpty(beginDate) || ValidateUtils.isNotNullOrEmpty(endDate)) {
            quickSearch = false;
        }
        if (StringHelper.isEmpty(type)) {
            quickSearch = false;
        }
        return quickSearch;
    }


}
